#!/usr/local/bin/python
#==============================================================================
#
#  $Id: rshserver,v 1.3 2001/02/05 17:46:38 mike Exp $
#
"""
   RSH server test program.
"""
#
#  Copyright (C) 2000 Michael A. Muller
#
#  Permission is granted to use, modify and redistribute this code,
#  providing that the following conditions are met:
#
#  1) This copyright/licensing notice must remain intact.
#  2) If the code is modified and redistributed, the modifications must 
#  include documentation indicating that the code has been modified.
#  3) The author(s) of this code must be indemnified and held harmless
#  against any damage resulting from the use of this code.
#
#  This code comes with ABSOLUTELY NO WARRANTEE, not even the implied 
#  warrantee of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
#
#  $Log: rshserver,v $
#  Revision 1.3  2001/02/05 17:46:38  mike
#  Fixed copyright dates.
#
#  Revision 1.2  2000/07/29 21:15:48  mike
#  Added docs.
#
#
#==============================================================================
import os, sys

# remove the current directory from the search path so that this runs ok
# from the dopy library directory
if sys.path[0] in ('', os.curdir):
   del sys.path[0]

import dopy
from dopy import rsh

class Test:
   
   def hello(self, str):
      sys.stderr.write('in hello\n')
      return 'hello ' + str

   def kwparms(self, p1, p2):
      sys.stderr.write('in kwparms\n')
      return (p1, p2)
   
   def raiseException(self):
      sys.stderr.write('in raiseException\n')
      raise Exception("Something bad happened")

rsh.makeServer()
hub = dopy.getHub()
hub.addObject('test', Test())
sys.stderr.write('waiting for method calls...\n')
rsh.wait()
